﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ScrumTime.Models.Story>" %>

<script type="text/javascript">
    function removeAssociation( storyId, relatedStoryId ) {
        jConfirm('This action will remove this association. Are you sure you want to continue?', 'Confirmation Dialog', function (r) {
            if (!r) return;
            var url = addURLRamdon('/Story/DeleteAssociation');
            $.post(url,
                {
                    storyId: storyId,
                    relatedStoryId: relatedStoryId
                },
                function (data) {                    
                    if (verificarError(data)) return;
                    refreshUsabilityStories(data);
                });
        });
        }

        function refreshUsabilityStories(data) {            
            $("#div_main_show_story_RelatedStory").html(data);
        }
</script>

<br />
<div style="width:100%">
    Usability Stories
</div>
<table style="width:964px;font-family:Verdana;padding:0;border:2px solid #999;height:30px;margin-left:0px;
            background-color:#f3f3f3;font-size:12px;color:#666;" cellpadding="0" cellspacing="0">
            <tr style="font-family:Verdana;padding:0;border:2px solid #999;margin-left:0px;background-color:#f3f3f3;font-size:12px;color:#666;">
                <td style="text-align:center;width:68px;border:0px;background-color:#f3f3f3;font-weight:bold;">Priority</td>
                <td style="text-align:center;width:102px;border:0px;background-color:#f3f3f3;font-weight:bold;">Id/Name</td>
                <td style="border:0px;width:490px;background-color:#f3f3f3;text-align:left;font-weight:bold;">Narrative</td>                                    
                <td style="text-align:center;width:80px;border:0px;background-color:#f3f3f3;font-weight:bold;">Actions</td>
                <td style="width:30px;border:0px;background-color:#f3f3f3;"></td>
            </tr>
            <% 
                foreach (  ScrumTime.Models.Story ubs in Model.Stories1) 
                    if( ubs.UsabilityStory!=null && ubs.UsabilityStory.isUsabilityStory      ){
            %>

             <tr>
                <td style="vertical-align:middle;text-align:center;width:68px;border:0px;font-size:11px;">
                    <a class="simpleLink" href="#" onclick="show_story(<%:ubs.StoryId%>)" > 
					<%: ubs.Priority.ToString() %> 
					</a>
                </td>
                <td style="vertical-align:middle;text-align:center;width:108px;border:0px;font-size:11px;">
                    <a class="simpleLink" href="#" style="font-style:italic;" onclick="show_story(<%:ubs.StoryId%>)" > 
                    <%: ubs.UserDefinedId %>
                    </a>
                </td>
                <td style="border:0px;width:510px">
                    <a class="simpleLink" href="#"onclick="show_story(<%:ubs.StoryId%>)" > 
                    <%: ubs.Narrative %>
                    </a>
                </td>                                
                <td style="vertical-align:middle;text-align:center;width:80px;border:0px;font-size:11px;">
                    <a title="Remove this association" href="#" onclick="removeAssociation(<%: Model.StoryId %>, <%: ubs.StoryId %>);">
                        <span class="ui-icon ui-icon-trash"></span>
                    </a>
                </td>
            </tr>
            <%        
                }                   
            %>
        
</table>

<br />

<div style="width:100%">
    Stories Derived From Usability Mechanisms
</div>

<table style="width:964px;font-family:Verdana;padding:0;border:2px solid #999;height:30px;margin-left:0px;
            background-color:#f3f3f3;font-size:12px;color:#666;" cellpadding="0" cellspacing="0">
            <tr style="font-family:Verdana;padding:0;border:2px solid #999;margin-left:0px;background-color:#f3f3f3;font-size:12px;color:#666;">
                <td style="text-align:center;width:68px;border:0px;background-color:#f3f3f3;font-weight:bold;">Priority</td>
                <td style="text-align:center;width:102px;border:0px;background-color:#f3f3f3;font-weight:bold;">Id/Name</td>
                <td style="border:0px;width:490px;background-color:#f3f3f3;text-align:left;font-weight:bold;">Narrative</td>                    
                <td style="text-align:center;width:80px;border:0px;background-color:#f3f3f3;font-weight:bold;">Actions</td>
                <td style="width:30px;border:0px;background-color:#f3f3f3;"></td>
            </tr>
            <% 
                foreach (  ScrumTime.Models.Story ubs in Model.Stories1) 
                    if( ubs.UsabilityStory!=null && ! ubs.UsabilityStory.isUsabilityStory  ){
            %>

             <tr>
                <td style="vertical-align:middle;text-align:center;width:68px;border:0px;font-size:11px;">
                    <a class="simpleLink" href="#" onclick="show_story(<%:ubs.StoryId%>)" > 
					<%: ubs.Priority.ToString() %> 
					</a>
                </td>
                <td style="vertical-align:middle;text-align:center;width:108px;border:0px;font-size:11px;">
                    <a class="simpleLink" href="#" style="font-style:italic;" onclick="show_story(<%:ubs.StoryId%>)" > 
                    <%: ubs.UserDefinedId %>
                    </a>
                </td>
                <td style="border:0px;width:510px">
                    <a class="simpleLink" href="#"onclick="show_story(<%:ubs.StoryId%>)" > 
                    <%: ubs.Narrative %>
                    </a>
                </td>                
                <td style="vertical-align:middle;text-align:center;width:80px;border:0px;font-size:11px;">
                    <a title="Remove this association" href="#" onclick="removeAssociation(<%: Model.StoryId %>, <%: ubs.StoryId %>);">
                        <span class="ui-icon ui-icon-trash"></span>
                    </a>                    
                </td>
            </tr>
            <%        
                }                   
            %>
        
</table>